<!DOCTYPE HTML><html>
<head>
<? echo $h->meta($title, $kwd, $dpn); ?>
<? require_once("lib.php"); ?>
</head>
<body id="">
<? include_once("header.php"); ?>
<div id="wrap">
	<div class="breadcrumb">
		<a href="./"><?=WEB_INDEX_PAGE?></a> &gt; <a href="member.html"><?=WEB_MEMBER_CENTER?></a> &gt; <span><?=$cate_name?></span>
	</div><!--breadcrumb end-->
	<div id="" class="w180 left">
		<? require 'member_menu.php' ?>
	</div><!--. w220-->
		<div id="" class="right w760">
			<div class="">
				<div class="h2news">
					<h2><?=$cate_name?></h2>
				</div>
				<div class="myorder">
					<div class="px10"></div>
					<div class="tright red">* <?printf(WEB_ORDER_WILL_BE_EXPIRED,ORDER_VALID_PERIOD)?></div>
					<div class="order_list">
						<table width="100%" class="tcenter">
							<tr class="order_list_h"><td width="360"><?=WEB_ORDERED_PRODUCT?></td><td width="120"><?=WEB_UNIT_PRICE?></td><td width="120"><?=WEB_QUANTITY?></td><td width="160"><?=WEB_ORDER_STATUS?></td></tr>
						</table>
						<?
							$str=''; $k=0;
                        $refund_code = $code_array['refund_status'];
							foreach($info as $val){
								$can_review=0;
								$arr_status=$status=$code_array['order_status'];
								$status=$arr_status[$val['order_status']]['name_'.$lang];
								$tem_payment_method=WEB_NOT_CHOOSED;
								if($val['payment_method_id']>0)
								if(isset($arr_payment[$val['payment_method_id']]))
								$tem_payment_method=$arr_payment[$val['payment_method_id']]['name_'.$lang];
//                                $refund_status = '';
                                $refund_status = $refund_info->get_row($val['ref_no'], 'sales_order_id');

								$str.='<table class="order_list_t" id="t'.$val['ref_no'].'">';
								$str.='
							<tr class="h"><td colspan="3">'.WEB_ORDER_REFERENCE.': <a href="old_order.php?code='.$val['ref_no'].'" class="blue">'.$val['ref_no'].'</a> &nbsp; '.WEB_ORDERED_TIME.' &nbsp;'.$val['created_time'].' &nbsp; '.WEB_PAYMENT_METHOD.' &nbsp;'.$tem_payment_method.'</td><td class="tcenter" width="160">';
                                if($val['order_status']<=1) {
								    if($val['payment_method_id'] != 5)
								    $str.='<a class="button_blue" href="old_order.php?code='.$val['ref_no'].'">'.WEB_GO_PAY.'</a>&nbsp;<a class="button_blue order_cancel" onclick="order_cancel(this)" id="order'.$val['ref_no'].'">'.WEB_ORDER_CANCEL.'</a>';
								    else $str.='<a class="button_blue order_cancel" onclick="order_cancel(this)" id="order'.$val['ref_no'].'">'.WEB_ORDER_CANCEL.'</a>';
							    }
							    elseif ($val['order_status']==4){
								    $str.='<a class="button_blue" href="myorder.php?do=delivery&page='.$page.'&code='.$val['ref_no'].'">'.WEB_CONFIRM_RECEIVED.'</a>';
							    }elseif($val['order_status'] == 2){
                                    $str.=$status.'&nbsp;<a class="button_blue cancel" onclick="order_cancel(this)" id="order'.$val['ref_no'].'">'.WEB_ORDER_CANCEL.'</a>';
                                }elseif($val['order_status'] == 3){
                                    $str.=$status.'&nbsp;<a class="button_blue cancel" onclick="order_cancel(this)" id="order'.$val['ref_no'].'">'.WEB_ORDER_CANCEL.'</a>';
                                }
							    else{
                                    if($val['order_status'] == 7){
                                        if($refund_status['refund_status'] == 0){
                                            $str .= $refund_code[$refund_status['refund_status']]['name_'.$lang];
                                        }else{
                                            $str .= $status.', '.$refund_code[$refund_status['refund_status']]['name_'.$lang];
                                        }
//                                  $str .= $refund_code[$refund_status['refund_status']]['name_'.$lang];
                                    }else{
                                        $str.=$status;
                                    }

								if($val['order_status']==5) $can_review=1;
							    }
								$tem_currency_id=$val['currency_id'];
								$tem_currency_sign=$arrcurrency[$tem_currency_id]['sign'];
							$str.='</td></tr>';
								$tem=$val['items'];
								//pre($tem);
								foreach($tem as $row){
									$tem_product=$product->get_row($row['product_id']);

									// variation
									$str_var='';
									if($row['product_variation_id']>0){
										$tem_var=$product_variation->get_row($row['product_variation_id']); // var
										if($tem_var['size']) $str_var.=$option_label[2].': '.$option_value[$tem_var['size']].' &nbsp; ';
										if($tem_var['color']) $str_var.=$option_label[1].': '.$option_value[$tem_var['color']].' &nbsp; ';
										if($tem_var['other1']) $str_var.=$option_label[3].': '.$option_value[$tem_var['other1']].' &nbsp; ';
										if($tem_var['other2']) $str_var.=$option_label[4].': '.$option_value[$tem_var['other2']].' &nbsp; ';
									}
									$str.='
							<tr class="l"><td width="360">
								<div style="padding: 8px 6px;">
								<div class="left" style="padding: 0 6px 0 0;"><a href="product-'.$row['product_id'].'.html" target="_blank"><img src="'.PRODUCT_PIC_HOST.$tem_product['small_pic'].'" width="60" /></a></div>
								<p><a href="product-'.$row['product_id'].'.html" target="_blank">'.$tem_product['name_'.$lang].'</a><br /><br /><span class="gray">'.$str_var.'</span></p>
								<br class="clear" />
								</div>
							</td><td width="120" class="tcenter">'.$tem_currency_sign.$row['unit_price'].'</td><td width="120" class="tcenter">'.$row['quantity'].'</td><td width="160" class="tcenter">';
//                                $str.='<a>申请返修/退换货</a><br><br>';
							if($row['is_reviewed']==0 && $can_review)$str.='<a class="button_blue" href="myreview.php?do=add&id='.$row['id'].'">'.WEB_WRITE_REVIEW.'</a><br><br><a href="order_service.php?detail_id='.$row['id'].'">'.WEB_ORDER_SERVICE_REPAIR.'</a>';
							else $str.='-';
							$str.='</td></tr>';

								}
							$str.='</table>';
							$k++;
							}
							echo $str;
						?>
					</div>
					<? echo echo_page($page, $pages, $url.'-p',$lang_id); ?>
				</div>
				<div class="clear"></div>
			</div><!--. featured product-->
	</div><!--# featured_and_ad_right-->
		<div class="clear"></div>
	<div class="px20"></div>
	<div class="clear"></div>
</div>
<? include("footer.php"); ?>
<script type="text/javascript">
function delivery_confirm(){ return confirm('<?=WEB_CONFIRM_TIP?>');}
    function order_cancel(node){
        //var order_id = $(node).parent().parent().children().eq(0).children('a').text();
        var order_id = $(node).attr('id');
        $('.credit').removeClass('hide');

        $('.credit').height($('body').height());
        $('input[name="order_id"]').val(order_id.substr(5));
    }
    $(function(){
        $('#cancel').click(function(){
            $('.credit').addClass('hide');
        });

        $('#submit').click(function(){
            var order_id = $('input[name="order_id"]').val();
            var reason_id = $('input[type="radio"]:checked').val();
            var reason_remark = $('.other_reason').val();
            if(typeof(reason_id) == "undefined"){
                alert(' 请选择原因!');
                return false;
            }
            //alert(reason_mask);
            $.ajax({
                url: 'order_cancel.php',
                data: {'order_id': order_id, 'do': 'cancel', 'reason_id': reason_id, 'reason_remark': reason_remark},
                type: 'get',
                success: function(data){
                    json = JSON.parse(data);
                    var ok=json.ok;
                    if(ok != 0){
                        $('.credit').addClass('hide');

                        //alert('订单取消成功');
                        $('#order'+json.order_id).parent().html(json.code);
                    }
                }
            });
        });

        $('input[type="radio"]').on('change', function(){
            if($(this).val() == 0){
                $('.other_reason').removeClass('hide');
            }else{
                $('.other_reason').addClass('hide');
            }
        });
    });
</script>
<style type="text/css">
    .credit{position:absolute;left:0;top:0;height:100%;width:100%;z-index:65536;}
    .credit{z-index:65537;background:rgba(0,0,0,0.22);}
    .crediter{height:100%;width:100%;font-size:24px;color:#666;line-height:1.5;z-index:65538;}
    .creditbox{text-align:center;margin:15% 40%;padding:12px 0 0;background:#eee;border-radius:16px}
    .creditbox h5{padding:5px 0 0px;font-size:18px}
    .creditbox label{padding:0 0; text-align: left; font-size: 12px}
    .creditg{width:200px;padding:12px;font-size: 20px; line-height: 24px; border-radius:5px;border:1px solid #bbb;background:#fff}
    .crediti{ padding: 10px 0 10px 0; font-size: 12px; text-align: center}
    .creditd{margin:10px 0 0;height:58px;border-top:1px solid #bbb}
    .creditd a{font-size:20px;font-weight:700;line-height:56px;color:#168DFE}

    .creditd2{height:66px;}
    .creditd2 a{font-size:36px;font-weight:700;line-height:86px;color:#168DFE}

    .crediti ul{width: 80%; margin-left: 10%}
    .reason_li{float: left; height: 40px; width: 45%}
    .pro{text-align: left}
    .other_reason{width:80%}
</style>
<div class="credit hide">
    <div class="crediter">
        <div class="creditbox">
            <h5><?=WEB_ORDER_CANCEL?></h5>
            <input type="hidden" name="order_id" value=""/>
            <div class="crediti">
                <ul>
                <?
                $i = 1;
                $str = '';
                foreach($refund as $key => $val){
                    $current=''; if($i%2==1) $current=' d ';
                    $str.='<li class="reason_li'.$current.'">
						<div class="pro_box">
							<div class="pro">
                            <input type="radio" class="reason_'.$val['id'].'" value="'.$val['id'].'" name="reason_id">'.$val['name_'.$lang].'
							</div>
						</div>
					</li>';
//                    if($i%2==0) $str.='<li class="pro_lace"></li>';
                    $i++;
                }
                $current=''; if($i%2==1) $current=' d ';
                $str .= '<li class="reason_li'.$current.'">
						<div class="pro_box">
							<div class="pro"><input type="radio" class="reason_0" value="0" name="reason_id">'.WEB_ORDER_CANCEL_OTHER_REASON.'
							</div>
						</div>
					</li>';
                echo $str;
                ?>
                </ul>
                <textarea class="other_reason hide" maxlength="50"></textarea>
            </div>
            <div style="clear: both"></div>
<!--            <div class="crediti"><label>　--><?//=WEB_ORDER_CANCEL?><!--：</label><input id="name" type="text" name="credit_code" class="creditg" maxlength="25" autofocus /></div>-->
            <div class="creditd"><a id="submit"><?=WEB_SUBMIT?></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a id="cancel"><?=WEB_CANCEL?></a></div>
        </div>
    </div>
</div>
</body>
</html>